<?php

namespace App\Model\Facades;

use Illuminate\Support\Facades\Validator;

class Common implements IExample
{
    static protected $interface;

    static public function create()
    {
        // TODO: Implement create() method.
        if (self::$interface === null) {
            self::$interface = new static();
        }
        return self::$interface;
    }

    public function add()
    {
        // TODO: Implement add() method.
    }

    public function edit($id)
    {
        // TODO: Implement edit() method.
    }

    public function show($id)
    {
        // TODO: Implement show() method.
    }

    public function index()
    {
        // TODO: Implement index() method.
    }

    public function delete()
    {
        // TODO: Implement delete() method.
    }

    public function dataValidator($data, $check, $mssage)
    {
        $error = null;

        $validator = Validator::make($data, $check, $mssage);

        if ($validator->fails()) {
            $error = $validator->errors()->first();
        }

        return [$error, $validator];
    }
}